import org.apache.http.HttpResponse;

import java.util.HashMap;
import java.util.Map;

public class Text {
    public static void main(String[] args) {
        String host = "http://staticmap.market.alicloudapi.com";
        String path = "/v3/staticmap";
        String method = "GET";
        String appcode = "你自己的AppCode";
        Map<String, String> headers = new HashMap<String, String>();
        //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
        headers.put("Authorization", "APPCODE " + appcode);
        Map<String, String> querys = new HashMap<String, String>();
        querys.put("labels", "朝阳公园,2,0,16,0xFFFFFF,0x008000:116.48482,39.94858");
        querys.put("location", "116.481485,39.990464");
        querys.put("markers", "mid,0xFF0000,A:116.481485,39.990464");
        querys.put("paths", "10,0x0000ff,1,,:116.31604,39.96491;116.320816,39.966606;116.321785,39.966827;116.32361,39.966957");
        querys.put("scale", "1");
        querys.put("size", "750*300");
        querys.put("traffic", "0");
        querys.put("zoom", "10");


        try {
            /**
             * 重要提示如下:
             * HttpUtils请从
             * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
             * 下载
             *
             * 相应的依赖请参照
             * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
             */
            HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
            System.out.println(response.toString());
            //获取response的body
            //System.out.println(EntityUtils.toString(response.getEntity()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
